package com.yuuzai.openworld.meter;

public class OverflowingMeter extends Meter {
	
	public void resetValue() {
		while (this.isFull()) {
			this.setDelta(0 - this.getMaximum());
		}
	}
	
	/* Overrides */
	
	public void setDelta(long value) {
		this.setValue(super.getValue() + value);
	}
	
	public long getValue() {
		long value = super.getValue();
		long limit = this.getMaximum();
		
		return (value > limit) ? limit : value;
	}
	
	public boolean getUnlimited() {
		return true;
	}
	
	/* Definition */
	
	public OverflowingMeter() {
		super();
	}
	
	public OverflowingMeter(long min, long max) {
		super(min, max);
	}
	
}
